package wang.Stream;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.function.Consumer;
import java.util.function.Predicate;
import java.util.stream.Stream;

public class Method {
    public static void main(String[] args) {
        ArrayList<String> list = new ArrayList<>();
        ArrayList<Integer> arrayList = new ArrayList<>();

        Collections.addAll(list, "wang", "wahh", "sss", "zhang","sss");
        Collections.addAll(arrayList, 1, 85, 56, 2, 13, 546, 12);
//        list.stream().filter(s -> {{return s.startsWith("w");}}).forEach(s -> System.out.println(s));
//       list.stream().limit(2).forEach(s -> System.out.println(s));
//       list.stream().skip(2).forEach(s -> System.out.println(s));
//        // list.forEach(s -> System.out.println(s));
        //    list.stream().skip(1).limit(2).forEach(s -> System.out.println(s));
      //  list.stream().distinct().forEach(s -> System.out.println(s));
//        Stream.concat(list.stream(),arrayList.stream()).forEach(s -> System.out.println(s));
        List<? extends Serializable> list1 = Stream.concat(list.stream(), arrayList.stream()).toList();
        //System.out.println(list1.get(1));
        list1.forEach((Consumer<Serializable>) serializable -> System.out.println(serializable));
    }
}
